<?php
if(empty($_GET["id"])) {
	include('top.php');
	?>
	<table width="100%" align="center">
	<tr><td width="80%">&nbsp;</td><td align="center"><a href="telefoon.php?id=printen" target="_blank"><img src="img/printer.png" width="48" height="48" alt="print" /></a></td></tr>
	<tr><td width="80%">&nbsp;</td><td align="center"><?php echo "<b>$printvriendelijk[$taal]</b>";?></td></tr>
	</table>
<?php
}
else {
	include_once('printstyle.php');
	$printen = "yes";
}
require_once('pasmy/dbwaarden.php');
$mysql_id = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($db, $mysql_id);
if($printen == "yes") { $tablet = '<table border="1" cellpadding="10">';}else { $tablet = '<table border="1" align="center" width="40%" cellpadding="10">';}
if (isset($_POST["invoer"]))
{
	$naam = $_POST["naam"] . " " . $_POST["voornaam"];
	$telefoon = $_POST["telefoon"];
	$sql = "insert into teldrivers (driver,nr) VALUES('$naam', '$telefoon')";
	echo "SQL: $sql<br>";
	$res = mysql_query($sql, $mysql_id);
	exit();
}
if(isset($_POST['toevoegen'])) 
{
	?>
	<form action="telefoon.php" method="post">
	<table align="center" border="1">
	<tr>
	<td colspan="2" class="delsaux">Ajouter un Num&eacute;ro de T&eacute;l&eacute;phone</td>
	</tr>
	<tr>
	<td>Nom</td>
	<td><input type="text" name="naam" size="30" maxlength="30"></td>
	</tr>
	<tr>
	<td>Pr&eacute;nom</td>
	<td><input type="text" name="voornaam" size="30" maxlength="30"></td>
	</tr>
	<td>N&deg; T&eacute;l&eacute;phone</td>
	<td><input type="text" name="telefoon" size="30" maxlength="80"></td>
	</tr>
	<tr><td colspan="2"><div style="text-align: center"><input type="submit" name="invoer" value="Ajouter"></div></td></tr>
	</table>
	</form>
	<?php
	exit();
}
?>
<br /><br /><br />

<form action="telefoon.php" method="post">
<?php echo $tablet;?><!-- <table border="1" align="center" width="40%" cellpadding="10"> -->
<tr>
<td colspan="4" class="delsaux"><?php echo $teldriver[$taal];?></td>
</tr>
<!-- <tr>
<td class="delsaux2" width="15%">GSM</td>
<td class="delsaux2" width="15%">Nr</td>
</tr> -->
<?php
$sql="Select * FROM teldrivers order by driver";
$res = mysql_query($sql, $mysql_id);
	while ($row = mysql_fetch_row($res)) {
		 echo "<tr><td><strong>$row[0]</strong></td>
		 <td><div style='text-align: center'><strong>$row[1]</strong></div></td>
		 <td><div style='text-align: center'><strong><a href=\"teldriverswijzigen.php?id=$row[2]\" class = 'linkblue'>Modifier<a></strong></div></td>
		 <td><div style='text-align: center'><strong><a href=\"teldriversverwijderen.php?id=$row[2]\" class = 'linkblue'>Supprimer<a></strong></div></td></tr>";		
	}
?>
	<tr><td colspan="4"><div style="text-align: center"><input type="submit" name="toevoegen" value="Ajouter"></div></td></tr>
</table>
</form>
<?php
include('footer.php');
?>